package club.janna.concurrency.example.immutable;

import club.janna.concurrency.annotation.ThreadSafe;
import com.google.common.collect.Maps;

import java.util.Collections;
import java.util.Map;

@ThreadSafe
public class ImmutableExample2 {


    private static Map<Integer, Integer> map = Maps.newHashMap();

    static {
        map.put(1, 1);
        map.put(2, 2);
        map.put(3, 3);
        map = Collections.unmodifiableMap(map);
    }

    public static void main(String[] args) {
        map.put(1, 4);
        System.out.println(map.get(1));
    }


}
